PHP failing to connect to GMail via IMAP [Edited!!]

Posted by Alexander on Server Fault See other posts from Server Fault or by Alexander
Published on 2009-08-21T23:55:35Z Indexed on 2011/01/08 7:55 UTC
Read the original article Hit count: 296

Filed under:
|
|
|
|

I have some php code that I'm trying to use to connect to gmail using imap. Here's the code:

$hostname = '{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX';
$tmp_username = 'username';
$tmp_password = 'password';
$inbox = imap_open($hostname, $username, $password) or die(imap_last_error());

And I get this error output everytime i try to connect:

Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX in /var/www/PHP/EmailScript.php on line 14 Login aborted

I dont understand what could be wrong!! I've heard of people having SSL errors but this doesnt seem to be one of those. Please please please help me!!!!!

Edit: When trying to connect to imap.gmail.com through telnet-ssl i get the following output:

Trying 74.125.155.109... Connected to gmail-imap.l.google.com. Escape character is '^]'.

And Nothign else happens

© Server Fault or respective owner

Related posts about php

Related posts about ssl